<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
  <meta name="description" content="API docs for the checkValidRange method from the RangeError class, for the Dart programming language.">
  <title>checkValidRange method - RangeError class - dart:core library - Dart API</title>
  <!-- required because all the links are pseudo-absolute -->
  <base href="../..">

  <link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500,400i,400,300|Source+Sans+Pro:400,300,700" rel="stylesheet">
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <link rel="stylesheet" href="static-assets/github.css">
  <link rel="stylesheet" href="static-assets/styles.css">
  <link rel="icon" href="static-assets/favicon.png">
  <!-- header placeholder -->
</head>

<body>

<div id="overlay-under-drawer"></div>

<header id="title">
  <button id="sidenav-left-toggle" type="button">&nbsp;</button>
  <ol class="breadcrumbs gt-separated dark hidden-xs">
    <li><a href="index.html">flutter_form_builder</a></li>
    <li><a href="dart-core/dart-core-library.html">dart:core</a></li>
    <li><a href="dart-core/RangeError-class.html">RangeError</a></li>
    <li class="self-crumb">checkValidRange method</li>
  </ol>
  <div class="self-name">checkValidRange</div>
  <form class="search navbar-right" role="search">
    <input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  </form>
</header>

<main>

  <div id="dartdoc-sidebar-left" class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
    <header id="header-search-sidebar" class="hidden-l">
      <form class="search-sidebar" role="search">
        <input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
      </form>
    </header>
    
    <ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
      <li><a href="index.html">flutter_form_builder</a></li>
      <li><a href="dart-core/dart-core-library.html">dart:core</a></li>
      <li><a href="dart-core/RangeError-class.html">RangeError</a></li>
      <li class="self-crumb">checkValidRange method</li>
    </ol>
    
    <h5>RangeError class</h5>
    <ol>
    
        <li class="section-title"><a href="dart-core/RangeError-class.html#constructors">Constructors</a></li>
        <li><a href="dart-core/RangeError/RangeError.html">RangeError</a></li>
        <li><a href="dart-core/RangeError/RangeError.index.html">index</a></li>
        <li><a href="dart-core/RangeError/RangeError.range.html">range</a></li>
        <li><a href="dart-core/RangeError/RangeError.value.html">value</a></li>
    
        <li class="section-title">
            <a href="dart-core/RangeError-class.html#instance-properties">Properties</a>
        </li>
        <li><a href="dart-core/RangeError/end.html">end</a></li>
        <li><a href="dart-core/RangeError/start.html">start</a></li>
        <li class="inherited"><a href="dart-core/Object/hashCode.html">hashCode</a></li>
        <li class="inherited"><a href="dart-core/ArgumentError/invalidValue.html">invalidValue</a></li>
        <li class="inherited"><a href="dart-core/ArgumentError/message.html">message</a></li>
        <li class="inherited"><a href="dart-core/ArgumentError/name.html">name</a></li>
        <li class="inherited"><a href="dart-core/Object/runtimeType.html">runtimeType</a></li>
        <li class="inherited"><a href="dart-core/Error/stackTrace.html">stackTrace</a></li>
    
        <li class="section-title inherited"><a href="dart-core/RangeError-class.html#instance-methods">Methods</a></li>
        <li class="inherited"><a href="dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
        <li class="inherited"><a href="dart-core/ArgumentError/toString.html">toString</a></li>
    
        <li class="section-title inherited"><a href="dart-core/RangeError-class.html#operators">Operators</a></li>
        <li class="inherited"><a href="dart-core/Object/operator_equals.html">operator ==</a></li>
    
    
        <li class="section-title"><a href="dart-core/RangeError-class.html#static-methods">Static methods</a></li>
        <li><a href="dart-core/RangeError/checkNotNegative.html">checkNotNegative</a></li>
        <li><a href="dart-core/RangeError/checkValidIndex.html">checkValidIndex</a></li>
        <li><a href="dart-core/RangeError/checkValidRange.html">checkValidRange</a></li>
        <li><a href="dart-core/RangeError/checkValueInInterval.html">checkValueInInterval</a></li>
    
    
    
    </ol>
  </div><!--/.sidebar-offcanvas-->

  <div id="dartdoc-main-content" class="col-xs-12 col-sm-9 col-md-8 main-content">
      <div><h1><span class="kind-method">checkValidRange</span> method</h1></div>

    <section class="multi-line-signature">
      <span class="returntype"><a href="dart-core/int-class.html">int</a></span>
            <span class="name ">checkValidRange</span>
(<wbr><span class="parameter" id="checkValidRange-param-start"><span class="type-annotation"><a href="dart-core/int-class.html">int</a></span> <span class="parameter-name">start</span>, [</span> <span class="parameter" id="checkValidRange-param-end"><span class="type-annotation"><a href="dart-core/int-class.html">int</a></span> <span class="parameter-name">end</span>, [</span> <span class="parameter" id="checkValidRange-param-length"><span class="type-annotation"><a href="dart-core/int-class.html">int</a></span> <span class="parameter-name">length</span>, [</span> <span class="parameter" id="checkValidRange-param-startName"><span class="type-annotation"><a href="dart-core/String-class.html">String</a></span> <span class="parameter-name">startName</span></span> <span class="parameter" id="checkValidRange-param-endName"><span class="type-annotation"><a href="dart-core/String-class.html">String</a></span> <span class="parameter-name">endName</span></span> <span class="parameter" id="checkValidRange-param-message"><span class="type-annotation"><a href="dart-core/String-class.html">String</a></span> <span class="parameter-name">message</span></span> ])
      
    </section>
    <section class="desc markdown">
      <p>Check that a range represents a slice of an indexable object.</p>
<p>Throws if the range is not valid for an indexable object with
the given <code>length</code>.
A range is valid for an indexable object with a given <code>length</code></p>
<p>if <code>0 &lt;= [start] &lt;= [end] &lt;= [length]</code>.
An <code>end</code> of <code>null</code> is considered equivalent to <code>length</code>.</p>
<p>The <code>startName</code> and <code>endName</code> defaults to <code>"start"</code> and <code>"end"</code>,
respectively.</p>
<p>Returns the actual <code>end</code> value, which is <code>length</code> if <code>end</code> is <code>null</code>,
and <code>end</code> otherwise.</p>
    </section>
    
    <section class="summary source-code" id="source">
      <h2><span>Implementation</span></h2>
      <pre class="language-dart"><code class="language-dart">static int checkValidRange(int start, int end, int length,
    [String startName, String endName, String message]) {
  &#47;&#47; Comparing with `0` as receiver produces better dart2js type inference.
  &#47;&#47; Ditto `start &gt; end` below.
  if (0 &gt; start || start &gt; length) {
    startName ??= &quot;start&quot;;
    throw RangeError.range(start, 0, length, startName, message);
  }
  if (end != null) {
    if (start &gt; end || end &gt; length) {
      endName ??= &quot;end&quot;;
      throw RangeError.range(end, start, length, endName, message);
    }
    return end;
  }
  return length;
}</code></pre>
    </section>

  </div> <!-- /.main-content -->

  <div id="dartdoc-sidebar-right" class="col-xs-6 col-sm-6 col-md-2 sidebar sidebar-offcanvas-right">
  </div><!--/.sidebar-offcanvas-->

</main>

<footer>
  <span class="no-break">
    flutter_form_builder
      3.8.2
  </span>

  <!-- footer-text placeholder -->
</footer>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="static-assets/typeahead.bundle.min.js"></script>
<script src="static-assets/highlight.pack.js"></script>
<script src="static-assets/URI.js"></script>
<script src="static-assets/script.js"></script>
<!-- footer placeholder -->

</body>

</html>
